{% extends "default/base.html" %}
{% load i18n %}
{% load sell_tags %}

{% block content %}
	{% block filter_content %}
		<div class="sidebar">
			<div class="well">
				<h5>{% trans "Categories" %}</h5>
				<ul>
					{% for category in marketplace.marketcategory_set.all %}
					{% ifnotequal category.product_set.count 0 %}
					<li class="{{category.slug}}"><a href="{% url market.views.search category.slug %}">{{ category.name }}<span class="label info category">{{ category.product_set.count }}</span></a></li>
		
					{% endifnotequal %}
					{% endfor %}
				</ul>
				<h5>{% trans "Shop" %} {{ marketplace.title }}</h5>
				<ul>
					<li><a href="{% url market_auctions %}">{% trans "Auctions" %}</a></li>
					<li><a href="{% url market_for_sale %}">{% trans "Items For Sale" %}</a></li>
				</ul>
				<h5>{% trans "Newsletter" %}</h5>
		  		 <form action="." method="post" class="form-stacked">
		    	    	{% if newsletter_form.email.errors %}<div data-alert="alert" class="alert-message warning">{{ newsletter_form.email.errors|join:", " }}</div>{% endif %}
				<label>{{ newsletter_form.email.label.title }}</label>
				{{ newsletter_form.email }} {{ newsletter_form.email.help_text }}
				<input class="btn success" type="submit" value="{% trans 'Subscribe' %}"> 
				    </form>
		 		<h5>Buy On Great Coins</h5>
				<ul>
				<li><a href="{% url buy_categories %}">Categories</a></li>
				<li><a href="{% url buy_show_search %}">Find Local Shows</a></li>
				<li><a href="{% url buy_latest_items %}">Latest Items</a></li>
				<li><a href="{% url buy_wish_list %}">Post Your Wish List</a></li>	
				</ul>
				<h5>Help Us!</h5>
				<ul>
				 <li><a class="btn primary" href="{% url market_survey %}" data-backdrop="true" data-keyboard="true" >Survey</a> </li>
				</ul>
			</div>
		</div>
	{% endblock %}

	{% block main_content %}
		<div class="span12">
			<h2>{{ marketplace.title }} Picks</h2>
	
			{# #################  Marketplace Picks ################################################### #}
	
			<div class="span12">
			  {% for pick in market_place_picks %}
				<div class="item_box">
					<a href="{% url view_item pick.product.id %}">
						{% if pick.product.child.image %}
							<img class="item" title="{{ pick.product.title|truncatewords:5 }}" src="{{ pick.product.child.image.image.url_100x100 }}" alt="{{ pick.product.description|striptags }}"/>
						{% else %}
							<img class="item" src="{{ STATIC_URL }}img/no-photo-medium.jpg" title="{{ pick.product.description|striptags }}" alt="{{ pick.product.description|striptags }}"/>
						{% endif %}
					</a>	
					<div class="title">{{ pick.product.title|truncatewords:5 }}</div>
					<div class="dealer">{{ pick.product.child.shop.name|truncatewords:2 }}</div>
					{% with pick.product.child.price|money_format2:pick.product.shop as price %}
						<div class="price">{{ price.0 }}.<span class="price_small">{{ price.1 }}</span></div>
					{% endwith %}
				</div>	
			  {% endfor %}
			</div>
	
			{# #################  Featured Dealers ################################################### #}
	
			<div class="span12">
				<h2>{% trans "Featured Dealers" %}</h2>
				{% for pick in featured_dealers %}
					<div id="{{ pick.shop.name }}" class="modal hide fade">
			            <div class="modal-header">
			            	<a href="#" class="close">&times;</a>
			              	<h3>{{ pick.shop.name|title }}</h3>
			            </div>
			            <div class="modal-body">
			            	<p>{% if pick.shop.owner.get_profile.photo %}
			            			<img src="{{ pick.shop.owner.get_profile.photo.url_400x400 }}" alt="{{ pick.description|striptags }}" />
			            	   {% else %}
			            	   		<img src="{{ STATIC_URL }}img/no-photo-shop2.png" alt="{{ pick.description|striptags }}" />
			            	   {% endif %}
							   {{ pick.shop.about.body|safe }}
				    		</p>
			            </div>
			            <div class="modal-footer">
			            	<a href="http://{{ pick.shop.default_dns }}" target="_blank" class="btn primary">Go To Dealer's Site</a>
			              	<a href="#" class="close btn secondary">Close</a>
			            </div>
					</div>
			 
					<div class="span5">
						<div class="dealer_box">
							{% if pick.shop.owner.get_profile.photo %}
								<img class="item" alt="{{ pick.shop.get_full_name }} {{ pick.shop.id }}" src="{{ pick.shop.owner.get_profile.photo.url_400x400 }}" height="100" width="100" alt="{{ pick.description|safe|truncatewords:4 }}"/>
							{% else %}
								<img class="item" alt="{{ pick.shop.name }}" src="{{ STATIC_URL }}img/no-photo-shop.png" height="100" width="100" alt="{{ pick.shop.name }}" />
							{% endif %}
							<div class="description">
								<p>{{ pick.shop.admin.get_full_name }}</p>
								<p>{{ pick.shop.about.body|striptags|truncatewords:5 }}</p>
						    </div>
						</div>
						<button data-controls-modal="{{ pick.shop.name }}" data-backdrop="true" data-keyboard="true" class="btn">More Info</button>
		 			</div>
				{% endfor %}
			</div>
			
			{# #################  Recently Listed Items ################################################### #}
			
			<div class="span12">
				<h2>{% trans "Recently Listed Items" %}</h2>
				{% for product in recently_products %}
					<div class="ImgHolder">
						<a href="{% url view_item product.id %}">
							{% if product.child.image %}
								<img class="item" alt=" {{ product.title }}" title="{{ product.title }}" width="50px" src="{{ product.child.image.image.url_100x100 }}" />
							{% else %}
								<img class="item" alt=" {{ product.title }}" title="{{ product.title }}" width="50px" src="{{ STATIC_URL }}img/no-photo-medium.jpg" />
							{% endif %}
						</a>
					</div>
				{% endfor %}
			</div>
		</div>
	{% endblock %}
{% endblock %}
